package net.maxwoods.nimble.springmvc.controller;

import com.alibaba.fastjson.JSONObject;
import net.maxwoods.nimble.springmvc.model.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class WebController {

    @Value("${db.url}")
    private String dbUrl;

    @GetMapping(value="/hello")
    public Object hello()
    {
        User user=new User();
        user.setName("max woods");
        user.setAge(40);
        return user;
    }

    @RequestMapping(value="/date")
    public Date date()
    {
        return new Date();
    }

    @RequestMapping(value="/config")
    public Object config()
    {
        return dbUrl;
    }
}
